#include <signal.h>
#include <iostream>
#include <unistd.h>
#include <sys/types.h>

void sigcb(int signal){
     std::cout<<"Signal is "<<signal<<" which Accepted"<<std::endl;
     sleep(1);
}
int main(){
    sigset_t New_Set,Old_Set;
    struct sigaction sa_usr;
    sa_usr.sa_flags = 0;
    sa_usr.sa_handler = sigcb;  
    sigaction(SIGKILL, &sa_usr, NULL);
     sigaction(SIGRTMIN+6, &sa_usr, NULL);
    sigemptyset (&New_Set);
    sigemptyset (&Old_Set);
    sigaddset(&New_Set,SIGINT);
    sigaddset(&New_Set, SIGRTMIN+6);
    sigprocmask(SIG_BLOCK,&New_Set,&Old_Set);
    int i=0;
    int j=0;
    while(true){
        sleep(1);
        std::cout<<"process runing i="<<i<<" j="<<j<<std::endl;
        if(i<=5){
        i++;
       std::cout<<kill(getpid(), SIGINT)<<std::endl;
        }
        else{
            j++;
            std::cout<<kill(getpid(), SIGRTMIN+6)<<std::endl;
        }
            if(j==6){
                break;
            }
    }
    return 0;
} 